package main;

import generation.GenerationCode;

import java.io.File;
import java.io.IOException;
import java.util.List;

import org.eclipse.emf.ecore.EObject;

import CDPackage.ClassDiagram;
import CDPackage.Clazz;

import transformation.Transformation;

/**
 * 
 */

/**
 * @author Pratik Bhavsar
 * 
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		UMLLoader umlLoader = UMLLoader.getInstance();

		List<EObject> objects = null;
		try {
			objects = umlLoader.loadUMLFromFile(new File("model\\MySM.uml"));

			for (EObject o : objects)

				System.out.println(o);

		} catch (IOException e) {
			e.printStackTrace();
		}

		ClassDiagram cd = Transformation.uml2ClassDiagram(objects);
		for (Clazz c : cd.getClazzes())
			System.out.println(c);

		// Generation de code
		GenerationCode.generateCode(cd, objects);

		// Generation Code Main
		GenerationCode.generateCodeMain(cd, objects);

	}

}
